/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_listebesoin")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvListebesoin.findAll", query = "SELECT c FROM CvListebesoin c"),
    @NamedQuery(name = "CvListebesoin.findByIdbesoin", query = "SELECT c FROM CvListebesoin c WHERE c.idbesoin = :idbesoin"),
    @NamedQuery(name = "CvListebesoin.findByDate", query = "SELECT c FROM CvListebesoin c WHERE c.date = :date"),
    @NamedQuery(name = "CvListebesoin.findByDepartementId", query = "SELECT c FROM CvListebesoin c WHERE c.departementId = :departementId"),
    @NamedQuery(name = "CvListebesoin.findByStatu", query = "SELECT c FROM CvListebesoin c WHERE c.statu = :statu"),
    @NamedQuery(name = "CvListebesoin.findByDemendeur", query = "SELECT c FROM CvListebesoin c WHERE c.demendeur = :demendeur")})
public class CvListebesoin implements Serializable {
    @Column(name = "recycle")
    private boolean recycle;
    @Column(name = "departementId")
    private Integer departementId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvListebesoinIdbesoin", fetch = FetchType.LAZY)
    private List<CvAffectationbesoin> cvAffectationbesoinList;
    @JoinColumn(name = "equipe", referencedColumnName = "idequipedepartement")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private CvEquipedepartement equipe;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idbesoin")
    private Integer idbesoin;
    @Basic(optional = false)
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Lob
    @Column(name = "commentaire")
    private String commentaire;
    @Basic(optional = false)
    @Column(name = "statu")
    private short statu;
    @Basic(optional = false)
    @Column(name = "demendeur")
    private int demendeur;

    public CvListebesoin() {
    }

    public CvListebesoin(Integer idbesoin) {
        this.idbesoin = idbesoin;
    }

    public CvListebesoin(Integer idbesoin, Date date, int departementId, short statu, int demendeur) {
        this.idbesoin = idbesoin;
        this.date = date;
        this.departementId = departementId;
        this.statu = statu;
        this.demendeur = demendeur;
    }

    public Integer getIdbesoin() {
        return idbesoin;
    }

    public void setIdbesoin(Integer idbesoin) {
        this.idbesoin = idbesoin;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getCommentaire() {
        return commentaire;
    }

    public void setCommentaire(String commentaire) {
        this.commentaire = commentaire;
    }

    public short getStatu() {
        return statu;
    }

    public void setStatu(short statu) {
        this.statu = statu;
    }

    public int getDemendeur() {
        return demendeur;
    }

    public void setDemendeur(int demendeur) {
        this.demendeur = demendeur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idbesoin != null ? idbesoin.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvListebesoin)) {
            return false;
        }
        CvListebesoin other = (CvListebesoin) object;
        if ((this.idbesoin == null && other.idbesoin != null) || (this.idbesoin != null && !this.idbesoin.equals(other.idbesoin))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvListebesoin[ idbesoin=" + idbesoin + " ]";
    }

    public CvEquipedepartement getEquipe() {
        return equipe;
    }

    public void setEquipe(CvEquipedepartement equipe) {
        this.equipe = equipe;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvAffectationbesoin> getCvAffectationbesoinList() {
        return cvAffectationbesoinList;
    }

    public void setCvAffectationbesoinList(List<CvAffectationbesoin> cvAffectationbesoinList) {
        this.cvAffectationbesoinList = cvAffectationbesoinList;
    }

    public Integer getDepartementId() {
        return departementId;
    }

    public void setDepartementId(Integer departementId) {
        this.departementId = departementId;
    }

    public boolean isRecycle() {
        return recycle;
    }

    public void setRecycle(Boolean recycle) {
        this.recycle = recycle;
    }
    
}
